/*
 *  POJ3982: Sequence
 */

/*-------- Includes --------*/
#include <iostream>
#include <cstring>

/*-------- Includes --------*/
#define MAX_SIZE 256
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))

using namespace std;

/*-------- Main Function --------*/
int main(int argc, char const *argv[])
{
    char cstr[3][8];

    while (cin >> cstr[0] >> cstr[1] >> cstr[2]) {
        int l[3];
        int A[3][MAX_SIZE] = {0};

        // Step 1: string number to array number(reverse and atoi)
        for (int i = 0; i < 3; i++) {
            int  n  = strlen(cstr[i]);
            int  *p = A[i];
            char *q = cstr[i];

            for (int j = 0; j < n; j++) p[j] = q[n - 1 - j] - '0';

            l[i] = n;
        }

        // Step 2: calculate A_i
        // store A_i in A[i % 3]
        for (int i = 3; i < 100; i++) {
            int k = i % 3;

            for (int j = 1; j < 3; j++) {
                int *p = A[k];
                int *q = A[(k + j) % 3];
                int n  = MAX(l[k], l[(k + j) % 3]);
                int c  = 0; // carry

                // add
                int t;
                for (t = 0; t < n; t++) {
                    c    += p[t] + q[t];
                    p[t]  = c % 10;
                    c    /= 10;
                }

                // carry bit
                if (c == 0) {
                    l[k] = t;
                } else {
                    p[t] = c;
                    l[k] = t + 1;
                }
            }
        }

        // print
        int *p = A[0];
        int n  = l[0];

        for (int i = n - 1; i >= 0; i--) cout << p[i];
        cout << endl;
    }

    return 0;
}
